//
//  ViewController.m
//  UI06_UIScrollView_相册
//
//  Created by Scott on 16/3/16.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "ViewController.h"
#import "MyScrollView.h"
#import "Album.h"


@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
//    [self createScrollView];
    [self createAlbum];
    
}

#pragma mark - Data
- (NSArray *)handleData {
    
    NSMutableArray *mArr = [NSMutableArray array];
    
    for (int i = 1; i < 5; i++) {
        
        NSString *name = [NSString stringWithFormat:@"%d.jpg", i];
        
        UIImage *image = [UIImage imageNamed:name];
        
        [mArr addObject:image];
    }
    
    return mArr;
}

#pragma mark - 知识点1: UIScrollView
- (void)createScrollView {
    
    NSArray *images = [self handleData];
    
    MyScrollView *scroll = [[MyScrollView alloc] initWithFrame:CGRectMake(0, 0, 300, 400) withImages:images];
    scroll.center = self.view.center;
    
    [self.view addSubview:scroll];
    [scroll release];
}


#pragma mark - 知识点2: 相册(scrollView结合PageControll使用)
- (void)createAlbum {
    
    Album *album = [[Album alloc] initWithFrame:CGRectMake(0, 0, 300, 400) withImages:[self handleData]];
    
    album.center = self.view.center;
    
    [self.view addSubview:album];
    [album release];
    
}


#pragma mark -
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
